home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  40.1 KB  |  1,308 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    Games Sprockets: InputSprocket interfaaces
  5.  
  6.      Version:    Technology:    InputSprocket 1.7
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1996-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __INPUTSPROCKET__
  18. #define __INPUTSPROCKET__
  19.  
  20. #ifndef __DESKBUS__
  21.     #include <DeskBus.h>
  22. #endif
  23.  
  24. #ifndef __DIALOGS__
  25.     #include <Dialogs.h>
  26. #endif
  27.  
  28. #ifndef __EVENTS__
  29.     #include <Events.h>
  30. #endif
  31.  
  32. #ifndef __ICONS__
  33.     #include <Icons.h>
  34. #endif
  35.  
  36. #ifndef __MACTYPES__
  37.     #include <MacTypes.h>
  38. #endif
  39.  
  40. #ifndef __MACERRORS__
  41.     #include <MacErrors.h>
  42. #endif
  43.  
  44.  
  45.  
  46.  
  47. #if PRAGMA_ONCE
  48. #pragma once
  49. #endif
  50.  
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54.  
  55. #if PRAGMA_IMPORT
  56. #pragma import on
  57. #endif
  58.  
  59. #if PRAGMA_STRUCT_ALIGN
  60.     #pragma options align=power
  61. #elif PRAGMA_STRUCT_PACKPUSH
  62.     #pragma pack(push, 2)
  63. #elif PRAGMA_STRUCT_PACK
  64.     #pragma pack(2)
  65. #endif
  66.  
  67. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  68. #define USE_OLD_INPUT_SPROCKET_LABELS 0
  69. #endif  /* !defined(USE_OLD_INPUT_SPROCKET_LABELS) */
  70.  
  71. #ifndef USE_OLD_ISPNEED_STRUCT
  72. #define USE_OLD_ISPNEED_STRUCT 0
  73. #endif  /* !defined(USE_OLD_ISPNEED_STRUCT) */
  74.  
  75. /* ********************* data types ********************* */
  76. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  77. typedef struct OpaqueISpElementReference*  ISpElementReference;
  78. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  79. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  80. typedef OSType                             ISpDeviceClass;
  81. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  82. typedef OSType                             ISpDeviceIdentifier;
  83. typedef OSType                             ISpElementLabel;
  84. typedef OSType                             ISpElementKind;
  85.  
  86.  
  87. /* *************** resources **************** */
  88. enum {
  89.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  90.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  91.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  92. };
  93.  
  94.  
  95. struct ISpApplicationResourceStruct {
  96.     UInt32                             flags;
  97.     UInt32                             reserved1;
  98.     UInt32                             reserved2;
  99.     UInt32                             reserved3;
  100. };
  101. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  102. enum {
  103.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  104.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  105. };
  106.  
  107. /*
  108.  * ISpDeviceDefinition
  109.  *
  110.  * This structure provides all the available
  111.  * information for an input device within the system
  112.  *
  113.  */
  114.  
  115. struct ISpDeviceDefinition {
  116.     Str63                             deviceName;                    /* a human readable name of the device */
  117.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  118.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  119.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  120.     UInt32                             flags;                        /* status flags */
  121.     UInt32                             permanentIDExtend;            /* extension of permanentID, so 64 bits total are now significant */
  122.     UInt32                             reserved2;
  123.     UInt32                             reserved3;
  124. };
  125. typedef struct ISpDeviceDefinition        ISpDeviceDefinition;
  126. enum {
  127.     kISpDeviceFlag_HandleOwnEmulation = 1
  128. };
  129.  
  130. /*
  131.  * ISpElementEvent, ISpElementEventPtr
  132.  *
  133.  * This is the structure that event data is passed in.
  134.  *
  135.  */
  136.  
  137. struct ISpElementEvent {
  138.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  139.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  140.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  141.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  142.     UInt32                             data;                        /* the data for this event */
  143. };
  144. typedef struct ISpElementEvent            ISpElementEvent;
  145. typedef ISpElementEvent *                ISpElementEventPtr;
  146. /*
  147.  * ISpElementInfo, ISpElementInfoPtr
  148.  *
  149.  * This is the generic definition of an element.
  150.  * Every element must contain this information.
  151.  *
  152.  */
  153.  
  154. struct ISpElementInfo {
  155.     ISpElementLabel                 theLabel;
  156.     ISpElementKind                     theKind;
  157.     Str63                             theString;
  158.     UInt32                             reserved1;
  159.     UInt32                             reserved2;
  160. };
  161. typedef struct ISpElementInfo            ISpElementInfo;
  162. typedef ISpElementInfo *                ISpElementInfoPtr;
  163.  
  164. typedef UInt32                             ISpNeedFlagBits;
  165. #if USE_OLD_ISPNEED_STRUCT
  166.  
  167. struct ISpNeed {
  168.     Str63                             name;
  169.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  170.     short                             reserved;
  171.     ISpElementKind                     theKind;
  172.     ISpElementLabel                 theLabel;
  173.     ISpNeedFlagBits                 flags;
  174.     UInt32                             reserved1;
  175.     UInt32                             reserved2;
  176.     UInt32                             reserved3;
  177. };
  178. typedef struct ISpNeed                    ISpNeed;
  179. #else
  180.  
  181. struct ISpNeed {
  182.     Str63                             name;                        /* human-readable string */
  183.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  184.     UInt8                             playerNum;                    /* used for multi-player support */
  185.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  186.     ISpElementKind                     theKind;
  187.     ISpElementLabel                 theLabel;
  188.     ISpNeedFlagBits                 flags;
  189.     UInt32                             reserved1;
  190.     UInt32                             reserved2;
  191.     UInt32                             reserved3;
  192. };
  193. typedef struct ISpNeed                    ISpNeed;
  194. #endif  /* USE_OLD_ISPNEED_STRUCT */
  195.  
  196. enum {
  197.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  198.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  199.     kISpNeedFlag_PolledOnly        = 0x00000004,
  200.     kISpNeedFlag_EventsOnly        = 0x00000008,
  201.     kISpNeedFlag_NoAutoConfig    = 0x00000010,                    /* this need can be set normally, but will not ever be auto configured*/
  202.     kISpNeedFlag_NoConfig        = 0x00000020,                    /* this need can not be changed by the user*/
  203.     kISpNeedFlag_Invisible        = 0x00000040,                    /* this need can not be seen by the user*/
  204.                                                                 /* *** kISpElementKind specific flags ****/
  205.                                                                 /* these are flags specific to kISpElementKind_Button*/
  206.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  207.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  208.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,
  209.     kISpNeedFlag_Button_AlreadyDelta = (long)0x80000000,        /* there is a delta version of this button need*/
  210.                                                                 /* these are flags specific to kISpElementKind_DPad*/
  211.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  212.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  213.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  214.     kISpNeedFlag_Axis_AlreadyDelta = 0x40000000,                /* there is a delta version of this axis need*/
  215.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  216.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000,                /* there is a axis version of this delta need*/
  217.     kISpNeedFlag_Delta_AlreadyButton = 0x20000000                /* there is a button version of this delta need*/
  218. };
  219.  
  220. /*
  221.  *
  222.  * These are the current built values for ISpDeviceClass
  223.  *
  224.  */
  225. enum {
  226.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  227.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  228.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  229.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  230.     kISpDeviceClass_Gamepad        = FOUR_CHAR_CODE('gmpd'),
  231.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  232.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  233.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  234.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl'),        /* a device of this class requires ISpTickle*/
  235.     kISpDeviceClass_Unknown        = FOUR_CHAR_CODE('????')
  236. };
  237.  
  238. /*
  239.  * These are the current built in ISpElementKind's
  240.  * 
  241.  * These are all OSTypes.
  242.  *
  243.  */
  244. enum {
  245.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  246.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  247.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  248.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  249.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  250.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  251. };
  252.  
  253.  
  254. /*
  255.  *
  256.  * These are the current built in ISpElementLabel's
  257.  *
  258.  * These are all OSTypes.
  259.  *
  260.  */
  261. #if USE_OLD_INPUT_SPROCKET_LABELS
  262. enum {
  263.                                                                 /* axis */
  264.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  265.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  266.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  267.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  268.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  269.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  270.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  271.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  272.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  273.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  274.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  275.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  276.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  277.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  278.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  279.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn'),        /* Pause/Resume was changed into 2 needs: Quit and start/pause */
  280.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt')
  281. };
  282.  
  283. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  284.  
  285. enum {
  286.                                                                 /* generic */
  287.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  288.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  289.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  290.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  291.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  292.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  293.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  294.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  295.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  296.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  297.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  298.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  299.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  300.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  301.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  302.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  303.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  304.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  305.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),
  306.     kISpElementLabel_Axis_ToeBrake = FOUR_CHAR_CODE('toeb'),    /* delta */
  307.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  308.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  309.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  310.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  311.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  312.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  313.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  314.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  315.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,
  316.     kISpElementLabel_Delta_Cursor_X = FOUR_CHAR_CODE('curx'),
  317.     kISpElementLabel_Delta_Cursor_Y = FOUR_CHAR_CODE('cury'),    /* direction pad */
  318.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),        /* up/down/left/right*/
  319.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* up/down/left/right*/
  320.     kISpElementLabel_Pad_POV_Horiz = FOUR_CHAR_CODE('hpov'),    /* forward/back/left/right*/
  321.     kISpElementLabel_Pad_Move_Horiz = FOUR_CHAR_CODE('hmov'),    /* forward/back/left/right*/
  322.                                                                 /* buttons */
  323.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  324.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  325.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  326.     kISpElementLabel_Btn_Quit    = FOUR_CHAR_CODE('strt'),        /* kISpElementLabel_Btn_Quit automatically binds to escape */
  327.     kISpElementLabel_Btn_StartPause = FOUR_CHAR_CODE('paus'),
  328.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  329.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  330.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  331.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  332.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  333.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  334.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  335.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  336.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  337.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  338.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  339.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  340.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  341.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  342.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  343.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok'),
  344.     kISpElementLabel_Btn_Minimum = FOUR_CHAR_CODE('min '),
  345.     kISpElementLabel_Btn_Decrement = FOUR_CHAR_CODE('decr'),
  346.     kISpElementLabel_Btn_Center    = FOUR_CHAR_CODE('cent'),
  347.     kISpElementLabel_Btn_Increment = FOUR_CHAR_CODE('incr'),
  348.     kISpElementLabel_Btn_Maximum = FOUR_CHAR_CODE('max '),
  349.     kISpElementLabel_Btn_10Percent = FOUR_CHAR_CODE(' 10 '),
  350.     kISpElementLabel_Btn_20Percent = FOUR_CHAR_CODE(' 20 '),
  351.     kISpElementLabel_Btn_30Percent = FOUR_CHAR_CODE(' 30 '),
  352.     kISpElementLabel_Btn_40Percent = FOUR_CHAR_CODE(' 40 '),
  353.     kISpElementLabel_Btn_50Percent = FOUR_CHAR_CODE(' 50 '),
  354.     kISpElementLabel_Btn_60Percent = FOUR_CHAR_CODE(' 60 '),
  355.     kISpElementLabel_Btn_70Percent = FOUR_CHAR_CODE(' 70 '),
  356.     kISpElementLabel_Btn_80Percent = FOUR_CHAR_CODE(' 80 '),
  357.     kISpElementLabel_Btn_90Percent = FOUR_CHAR_CODE(' 90 '),
  358.     kISpElementLabel_Btn_MouseOne = FOUR_CHAR_CODE('mou1'),
  359.     kISpElementLabel_Btn_MouseTwo = FOUR_CHAR_CODE('mou2'),
  360.     kISpElementLabel_Btn_MouseThree = FOUR_CHAR_CODE('mou3')
  361. };
  362.  
  363. /*
  364.  *
  365.  * direction pad data & configuration information
  366.  *
  367.  */
  368.  
  369. typedef UInt32 ISpDPadData;
  370. enum {
  371.     kISpPadIdle                    = 0,
  372.     kISpPadLeft                    = 1,
  373.     kISpPadUpLeft                = 2,
  374.     kISpPadUp                    = 3,
  375.     kISpPadUpRight                = 4,
  376.     kISpPadRight                = 5,
  377.     kISpPadDownRight            = 6,
  378.     kISpPadDown                    = 7,
  379.     kISpPadDownLeft                = 8
  380. };
  381.  
  382.  
  383. struct ISpDPadConfigurationInfo {
  384.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  385.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  386. };
  387. typedef struct ISpDPadConfigurationInfo    ISpDPadConfigurationInfo;
  388. /*
  389.  *
  390.  * button data & configuration information
  391.  *
  392.  */
  393.  
  394. typedef UInt32 ISpButtonData;
  395. enum {
  396.     kISpButtonUp                = 0,
  397.     kISpButtonDown                = 1
  398. };
  399.  
  400.  
  401. struct ISpButtonConfigurationInfo {
  402.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  403. };
  404. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  405. /*
  406.  *
  407.  * axis data & configuration information 
  408.  *
  409.  */
  410.  
  411. typedef UInt32                             ISpAxisData;
  412.  
  413. #define    kISpAxisMinimum  0x00000000U
  414. #define    kISpAxisMiddle   0x7FFFFFFFU
  415. #define    kISpAxisMaximum  0xFFFFFFFFU
  416.  
  417.  
  418. struct ISpAxisConfigurationInfo {
  419.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  420. };
  421. typedef struct ISpAxisConfigurationInfo    ISpAxisConfigurationInfo;
  422.  
  423. typedef Fixed                             ISpDeltaData;
  424.  
  425. struct ISpDeltaConfigurationInfo {
  426.     UInt32                             reserved1;
  427.     UInt32                             reserved2;
  428. };
  429. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  430.  
  431. struct ISpMovementData {
  432.     ISpAxisData                     xAxis;
  433.     ISpAxisData                     yAxis;
  434.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  435. };
  436. typedef struct ISpMovementData            ISpMovementData;
  437.  
  438. struct ISpMovementConfigurationInfo {
  439.     UInt32                             reserved1;
  440.     UInt32                             reserved2;
  441. };
  442. typedef struct ISpMovementConfigurationInfo ISpMovementConfigurationInfo;
  443. enum {
  444.     kISpVirtualElementFlag_UseTempMem = 1
  445. };
  446.  
  447. enum {
  448.     kISpElementListFlag_UseTempMem = 1
  449. };
  450.  
  451. enum {
  452.     kISpFirstIconSuite            = 30000,
  453.     kISpLastIconSuite            = 30100,
  454.     kISpNoneIconSuite            = 30000
  455. };
  456.  
  457.  
  458. /* ********************* user level functions ********************* */
  459. /*
  460.  *
  461.  * startup / shutdown
  462.  *
  463.  */
  464. EXTERN_API_C( OSStatus )
  465. ISpStartup                        (void);
  466.  
  467. /* 1.1 or later*/
  468. EXTERN_API_C( OSStatus )
  469. ISpShutdown                        (void);
  470.  
  471. /* 1.1 or later*/
  472. /*
  473.  *
  474.  * polling
  475.  *
  476.  */
  477. EXTERN_API_C( OSStatus )
  478. ISpTickle                        (void);
  479.  
  480. /* 1.1 or later*/
  481. /********** user interface functions **********/
  482.  
  483. EXTERN_API_C( NumVersion )
  484. ISpGetVersion                    (void);
  485.  
  486. /*
  487.  *
  488.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  489.  *
  490.  */
  491. EXTERN_API_C( OSStatus )
  492. ISpElement_NewVirtual            (UInt32                 dataSize,
  493.                                  ISpElementReference *    outElement,
  494.                                  UInt32                 flags);
  495.  
  496. /*
  497.  *
  498.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  499.  *
  500.  */
  501. EXTERN_API_C( OSStatus )
  502. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  503.                                  ISpNeed *                needs,
  504.                                  ISpElementReference *    outElements,
  505.                                  UInt32                 flags);
  506.  
  507. /*
  508.  *
  509.  * ISpElement_DisposeVirtual(inElement);
  510.  *
  511.  */
  512. EXTERN_API_C( OSStatus )
  513. ISpElement_DisposeVirtual        (UInt32                 count,
  514.                                  ISpElementReference *    inElements);
  515.  
  516. /*
  517.  * ISpInit
  518.  *
  519.  */
  520. EXTERN_API_C( OSStatus )
  521. ISpInit                            (UInt32                 count,
  522.                                  ISpNeed *                needs,
  523.                                  ISpElementReference *    inReferences,
  524.                                  OSType                 appCreatorCode,
  525.                                  OSType                 subCreatorCode,
  526.                                  UInt32                 flags,
  527.                                  short                     setListResourceId,
  528.                                  UInt32                 reserved);
  529.  
  530.  
  531. /*
  532.  * ISpConfigure
  533.  *
  534.  */
  535. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  536. EXTERN_API_C( OSStatus )
  537. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  538.  
  539. /*
  540.  *
  541.  * ISpStop
  542.  *
  543.  */
  544. EXTERN_API_C( OSStatus )
  545. ISpStop                            (void);
  546.  
  547. /*
  548.  *
  549.  * ISpSuspend, ISpResume
  550.  *
  551.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  552.  * ISpResume resumes to the previous state of the system after a suspend call.
  553.  * 
  554.  * Return Codes
  555.  * memFullErr
  556.  *
  557.  */
  558. EXTERN_API_C( OSStatus )
  559. ISpSuspend                        (void);
  560.  
  561. EXTERN_API_C( OSStatus )
  562. ISpResume                        (void);
  563.  
  564. /*
  565.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  566.  *
  567.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  568.  *
  569.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  570.  * buffer - a pointer to your buffer
  571.  * outCount - contains the number of devices in the system
  572.  *
  573.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  574.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  575.  *
  576.  * Return Codes
  577.  * paramErr
  578.  *
  579.  */
  580. EXTERN_API_C( OSStatus )
  581. ISpDevices_Extract                (UInt32                 inBufferCount,
  582.                                  UInt32 *                outCount,
  583.                                  ISpDeviceReference *    buffer);
  584.  
  585. EXTERN_API_C( OSStatus )
  586. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  587.                                  UInt32                 inBufferCount,
  588.                                  UInt32 *                outCount,
  589.                                  ISpDeviceReference *    buffer);
  590.  
  591. EXTERN_API_C( OSStatus )
  592. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  593.                                  UInt32                 inBufferCount,
  594.                                  UInt32 *                outCount,
  595.                                  ISpDeviceReference *    buffer);
  596.  
  597.  
  598. /*
  599.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  600.  *
  601.  * ISpDevices_Activate, ISpDevices_Deactivate
  602.  *
  603.  * This will activate/deactivate a block of devices.
  604.  * inDeviceCount - the number of devices to activate / deactivate
  605.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  606.  *
  607.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  608.  * inClass - the class of devices to activate or deactivate
  609.  *
  610.  * ISpDevice_IsActive
  611.  * inDevice - the device reference that you wish to 
  612.  * outIsActive - a boolean value that is true when the device is active
  613.  *
  614.  * Return Codes
  615.  * paramErr
  616.  *
  617.  */
  618. EXTERN_API_C( OSStatus )
  619. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  620.  
  621. /* 1.1 or later*/
  622. EXTERN_API_C( OSStatus )
  623. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  624.  
  625. /* 1.1 or later*/
  626. EXTERN_API_C( OSStatus )
  627. ISpDevices_Activate                (UInt32                 inDeviceCount,
  628.                                  ISpDeviceReference *    inDevicesToActivate);
  629.  
  630. EXTERN_API_C( OSStatus )
  631. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  632.                                  ISpDeviceReference *    inDevicesToDeactivate);
  633.  
  634. EXTERN_API_C( OSStatus )
  635. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  636.                                  Boolean *                outIsActive);
  637.  
  638. /*
  639.  * ISpDevice_GetDefinition
  640.  *
  641.  *
  642.  * inDevice - the device you want to get the definition for
  643.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  644.  * outStruct - a pointer to where you want the structure copied
  645.  *
  646.  * Return Codes
  647.  * paramErr
  648.  *
  649.  */
  650. EXTERN_API_C( OSStatus )
  651. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  652.                                  UInt32                 inBuflen,
  653.                                  ISpDeviceDefinition *    outStruct);
  654.  
  655.  
  656. /*
  657.  *
  658.  * ISpDevice_GetElementList
  659.  *
  660.  * inDevice - the device whose element list you wish to get
  661.  * outElementList - a pointer to where you want a reference to that list stored
  662.  *
  663.  * Return Codes
  664.  * paramErr
  665.  *
  666.  */
  667. EXTERN_API_C( OSStatus )
  668. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  669.                                  ISpElementListReference * outElementList);
  670.  
  671. /*
  672.  *
  673.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  674.  * no group
  675.  *
  676.  * Return Codes
  677.  * paramErr
  678.  *
  679.  */
  680. EXTERN_API_C( OSStatus )
  681. ISpElement_GetGroup                (ISpElementReference     inElement,
  682.                                  UInt32 *                outGroup);
  683.  
  684. /*
  685.  *
  686.  * takes an ISpElementReference and returns the device that the element belongs 
  687.  * to.
  688.  *
  689.  * Return Codes
  690.  * paramErr if inElement is 0 or outDevice is nil
  691.  *
  692.  */
  693. EXTERN_API_C( OSStatus )
  694. ISpElement_GetDevice            (ISpElementReference     inElement,
  695.                                  ISpDeviceReference *    outDevice);
  696.  
  697. /*
  698.  *
  699.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  700.  * the set of standard information.  You get ISpElementKind specific information
  701.  * through ISpElement_GetConfigurationInfo.
  702.  *
  703.  * Return Codes
  704.  * paramErr if inElement is 0 or outInfo is nil
  705.  *
  706.  */
  707. EXTERN_API_C( OSStatus )
  708. ISpElement_GetInfo                (ISpElementReference     inElement,
  709.                                  ISpElementInfoPtr         outInfo);
  710.  
  711. /*
  712.  *
  713.  *         
  714.  *
  715.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  716.  * 
  717.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  718.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  719.  * will return something error.
  720.  *
  721.  * Return Codes
  722.  * paramErr if inElement or configInfo is nil
  723.  *
  724.  */
  725. EXTERN_API_C( OSStatus )
  726. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  727.                                  UInt32                 buflen,
  728.                                  void *                    configInfo);
  729.  
  730. /*
  731.  *
  732.  * ISpElement_GetSimpleState
  733.  *
  734.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  735.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  736.  * whose data fits in a signed 32 bit integer.
  737.  *
  738.  *
  739.  *
  740.  * Return Codes
  741.  * paramErr if inElement is 0 or state is nil
  742.  *
  743.  */
  744. EXTERN_API_C( OSStatus )
  745. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  746.                                  UInt32 *                state);
  747.  
  748. /*
  749.  *
  750.  * ISpElement_GetComplexState
  751.  *
  752.  * Takes an ISpElementReference and returns the current state of that element.  
  753.  * Will copy up to buflen bytes of the current state of the device into
  754.  * state.
  755.  *
  756.  *
  757.  * Return Codes
  758.  * paramErr if inElement is 0 or state is nil
  759.  *
  760.  */
  761. EXTERN_API_C( OSStatus )
  762. ISpElement_GetComplexState        (ISpElementReference     inElement,
  763.                                  UInt32                 buflen,
  764.                                  void *                    state);
  765.  
  766.  
  767. /*
  768.  * ISpElement_GetNextEvent
  769.  *
  770.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  771.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  772.  * was not enough space to fill in the whole event structure that event will be
  773.  * dequed, as much of the event as will fit in the buffer will by copied and
  774.  * ISpElement_GetNextEvent will return an error.
  775.  *
  776.  * Return Codes
  777.  * paramErr
  778.  *
  779.  */
  780. EXTERN_API_C( OSStatus )
  781. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  782.                                  UInt32                 bufSize,
  783.                                  ISpElementEventPtr     event,
  784.                                  Boolean *                wasEvent);
  785.  
  786. /*
  787.  *
  788.  * ISpElement_Flush
  789.  *
  790.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  791.  * that any events that made it to this layer before the time of the flush call will be flushed and
  792.  * it will not flush any events that make it to this layer after the time when the call has returned.
  793.  * What happens to events that occur during the flush is undefined.
  794.  *
  795.  *
  796.  * Return Codes
  797.  * paramErr
  798.  *
  799.  */
  800. EXTERN_API_C( OSStatus )
  801. ISpElement_Flush                (ISpElementReference     inElement);
  802.  
  803.  
  804. /*
  805.  * ISpElementList_New
  806.  *
  807.  * Creates a new element list and returns it in outElementList.  In count specifies 
  808.  * the number of element references in the list pointed to by inElements.  If inCount
  809.  * is non zero the list is created with inCount elements in at as specified by the 
  810.  * inElements parameter.  Otherwise the list is created empty.
  811.  *
  812.  *
  813.  * Return Codes
  814.  * out of memory - If it failed to allocate the list because it was out of memory
  815.                    it will also set outElementList to 0
  816.  * paramErr if outElementList was nil
  817.  *
  818.  *
  819.  * Special Concerns
  820.  *
  821.  * interrupt unsafe
  822.  *
  823.  */
  824. EXTERN_API_C( OSStatus )
  825. ISpElementList_New                (UInt32                 inCount,
  826.                                  ISpElementReference *    inElements,
  827.                                  ISpElementListReference * outElementList,
  828.                                  UInt32                 flags);
  829.  
  830. /*
  831.  * ISpElementList_Dispose
  832.  *
  833.  * Deletes an already existing memory list.  
  834.  *
  835.  *
  836.  * Return Codes
  837.  * paramErr if inElementList was 0
  838.  *
  839.  *
  840.  * Special Concerns
  841.  *
  842.  * interrupt unsafe
  843.  *
  844.  */
  845. EXTERN_API_C( OSStatus )
  846. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  847.  
  848. /*
  849.  * ISpGetGlobalElementList
  850.  *
  851.  * returns the global element list
  852.  *
  853.  * Return Codes
  854.  * paramErr if outElementList is nil
  855.  *
  856.  */
  857. EXTERN_API_C( OSStatus )
  858. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  859.  
  860. /*
  861.  * ISpElementList_AddElement
  862.  *
  863.  * adds an element to the element list
  864.  *
  865.  * Return Codes
  866.  * paramErr if inElementList is 0 or newElement is 0
  867.  * memory error if the system is unable to allocate enough memory
  868.  *
  869.  * Special Concerns
  870.  * interrupt Unsafe
  871.  * 
  872.  */
  873. EXTERN_API_C( OSStatus )
  874. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  875.                                  UInt32                 refCon,
  876.                                  UInt32                 count,
  877.                                  ISpElementReference *    newElements);
  878.  
  879. /*
  880.  * ISpElementList_RemoveElement
  881.  *
  882.  * removes the specified element from the element list
  883.  *
  884.  * Return Codes
  885.  * paramErr if inElementList is 0 or oldElement is 0
  886.  * memory error if the system is unable to allocate enough memory
  887.  *
  888.  * Special Concerns
  889.  * interrupt Unsafe
  890.  * 
  891.  */
  892. EXTERN_API_C( OSStatus )
  893. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  894.                                  UInt32                 count,
  895.                                  ISpElementReference *    oldElement);
  896.  
  897. /*
  898.  * ISpElementList_Extract
  899.  *
  900.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  901.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  902.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  903.  * that number and the size of the array into the buffer.
  904.  *
  905.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  906.  * that have the specified kind and label.
  907.  *
  908.  * Return Codes
  909.  * paramErr
  910.  *
  911.  */
  912. EXTERN_API_C( OSStatus )
  913. ISpElementList_Extract            (ISpElementListReference  inElementList,
  914.                                  UInt32                 inBufferCount,
  915.                                  UInt32 *                outCount,
  916.                                  ISpElementReference *    buffer);
  917.  
  918. EXTERN_API_C( OSStatus )
  919. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  920.                                  ISpElementKind         inKind,
  921.                                  UInt32                 inBufferCount,
  922.                                  UInt32 *                outCount,
  923.                                  ISpElementReference *    buffer);
  924.  
  925. EXTERN_API_C( OSStatus )
  926. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  927.                                  ISpElementLabel         inLabel,
  928.                                  UInt32                 inBufferCount,
  929.                                  UInt32 *                outCount,
  930.                                  ISpElementReference *    buffer);
  931.  
  932. /*
  933.  * ISpElementList_GetNextEvent
  934.  *
  935.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  936.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  937.  * was not enough space to fill in the whole event structure that event will be
  938.  * dequed, as much of the event as will fit in the buffer will by copied and
  939.  * ISpElementList_GetNextEvent will return an error.
  940.  *
  941.  * Return Codes
  942.  * paramErr
  943.  *
  944.  */
  945. EXTERN_API_C( OSStatus )
  946. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  947.                                  UInt32                 bufSize,
  948.                                  ISpElementEventPtr     event,
  949.                                  Boolean *                wasEvent);
  950.  
  951. /*
  952.  *
  953.  * ISpElementList_Flush
  954.  *
  955.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  956.  * that any events that made it to this layer before the time of the flush call will be flushed and
  957.  * it will not flush any events that make it to this layer after the time when the call has returned.
  958.  * What happens to events that occur during the flush is undefined.
  959.  *
  960.  *
  961.  * Return Codes
  962.  * paramErr
  963.  *
  964.  */
  965. EXTERN_API_C( OSStatus )
  966. ISpElementList_Flush            (ISpElementListReference  inElementList);
  967.  
  968. /*
  969.  *
  970.  * ISpTimeToMicroseconds
  971.  *
  972.  *
  973.  * This function takes time from an input sprocket event and converts it
  974.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  975.  *
  976.  *
  977.  * Return Codes
  978.  * paramErr
  979.  *
  980.  */
  981. EXTERN_API_C( OSStatus )
  982. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  983.                                  UnsignedWide *            outMicroseconds);
  984.  
  985. /*
  986.  *
  987.  * ISpUptime
  988.  *
  989.  *
  990.  * This funtion returns the current machine dependant time, identical in form
  991.  * to that in an InputSprocket event. (Version 1.1 or later of InputSprocket).
  992.  *
  993.  *
  994.  */
  995. EXTERN_API_C( AbsoluteTime )
  996. ISpUptime                        (void);
  997.  
  998.  
  999. /****************************************************************************/
  1000. /*    Interfaces for InputSprocket Drivers                                    */
  1001. /*                                                                            */
  1002. /*    These APIs should be called only from InputSprocket drivers                */
  1003. /*                                                                            */
  1004. /*    (Moved from InputSprocketDriver.h, which is now obsolete.                */
  1005. /****************************************************************************/
  1006.  
  1007. /*
  1008.  
  1009. Resource File Concerns
  1010.  
  1011. 1. All resource ids of a driver should be in the range of 256 to 2048
  1012. and the res file should only be open while the drivers panel is visable.
  1013.  
  1014. */
  1015. enum {
  1016.     kOSType_ISpDriverFileType    = FOUR_CHAR_CODE('shlb'),
  1017.     kOSType_ISpDriverCreator    = FOUR_CHAR_CODE('insp')
  1018. };
  1019.  
  1020. /*
  1021.  *
  1022.  * this function will plot an icon suite of the application (usually for a need)
  1023.  *
  1024.  */
  1025. EXTERN_API_C( OSErr )
  1026. ISpPlotAppIconSuite                (const Rect *            theRect,
  1027.                                  IconAlignmentType         align,
  1028.                                  IconTransformType         transform,
  1029.                                  short                     iconSuiteResourceId);
  1030.  
  1031. /* label2,5,6,7, disabled and offline are reserved*/
  1032.  
  1033. enum {
  1034.     kISpIconTransform_Selected    = kTransformSelected,            /* choose one of these (optionally) (these all erase what is behind them to the dialog color)*/
  1035.     kISpIconTransform_PlotIcon    = kTransformLabel1,
  1036.     kISpIconTransform_PlotPopupButton = kTransformLabel3,
  1037.     kISpIconTransform_PlotButton = kTransformLabel4,            /* use this is you want to plot the icon while the devices button is pressed*/
  1038.                                                                 /* or the devices axis is activated and so on*/
  1039.     kISpIconTransform_DeviceActive = kTransformOpen
  1040. };
  1041.  
  1042.  
  1043. typedef UInt32 ISpMetaHandlerSelector;
  1044. enum {
  1045.     kISpSelector_Init            = 1,
  1046.     kISpSelector_Stop            = 2,
  1047.     kISpSelector_GetSize        = 3,
  1048.     kISpSelector_HandleEvent    = 4,
  1049.     kISpSelector_Show            = 5,
  1050.     kISpSelector_Hide            = 6,
  1051.     kISpSelector_BeginConfiguration = 7,
  1052.     kISpSelector_EndConfiguration = 8,
  1053.     kISpSelector_GetIcon        = 9,
  1054.     kISpSelector_GetState        = 10,
  1055.     kISpSelector_SetState        = 11,
  1056.     kISpSelector_Dirty            = 12,
  1057.     kISpSelector_SetActive        = 13,
  1058.     kISpSelector_DialogItemHit    = 14,
  1059.     kISpSelector_Tickle            = 15,                            /* 1.03 and later*/
  1060.     kISpSelector_InterruptTickle = 16,
  1061.     kISpSelector_Draw            = 17,
  1062.     kISpSelector_Click            = 18,
  1063.     kISpSelector_ADBReInit        = 19,                            /* 1.2 and later*/
  1064.     kISpSelector_GetCalibration    = 20,                            /* 1.7 and later*/
  1065.     kISpSelector_SetCalibration    = 21,
  1066.     kISpSelector_CalibrateDialog = 22
  1067. };
  1068.  
  1069.  
  1070. /*
  1071.  *
  1072.  * typedefs for the function pointers the metahandler may return 
  1073.  *
  1074.  */
  1075. /* a generic driver function pointer */
  1076. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Generic )(UInt32 refCon,  ...);
  1077. /* the meta handler pointer */
  1078. typedef CALLBACK_API_C( ISpDriverFunctionPtr_Generic , ISpDriverFunctionPtr_MetaHandler )(UInt32 refCon, ISpMetaHandlerSelector metaHandlerSelector);
  1079. /* the pointers you get through the meta handler */
  1080. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Init )(UInt32 refCon, UInt32 count, ISpNeed needs[], ISpElementReference virtualElements[], Boolean used[], OSType appCreatorCode, OSType subCreatorCode, UInt32 reserved, void *reserved2);
  1081. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Stop )(UInt32 refCon);
  1082. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetSize )(UInt32 refCon, Point *minimum, Point *best);
  1083. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_HandleEvent )(UInt32 refCon, EventRecord *theEvent, Boolean *handled);
  1084. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Show )(UInt32 refCon, DialogPtr theDialog, short dialogItemNumber, Rect *r);
  1085. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Hide )(UInt32 refCon);
  1086. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_BeginConfiguration )(UInt32 refCon, UInt32 count, ISpNeed needs[]);
  1087. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_EndConfiguration )(UInt32 refCon, Boolean accept);
  1088. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetIcon )(UInt32 refCon, short *iconSuiteResourceId);
  1089. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetState )(UInt32 refCon, UInt32 buflen, void *buffer, UInt32 *length);
  1090. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetState )(UInt32 refCon, UInt32 length, void *buffer);
  1091. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Dirty )(UInt32 refCon, Boolean *dirty);
  1092. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetActive )(UInt32 refCon, Boolean active);
  1093. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_DialogItemHit )(UInt32 refCon, short itemHit);
  1094. /* 1.03 and later*/
  1095. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Tickle )(UInt32 refCon);
  1096. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_InterruptTickle )(UInt32 refCon);
  1097. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Draw )(UInt32 refCon);
  1098. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Click )(UInt32 refCon, const EventRecord *event);
  1099. /* 1.2 and later*/
  1100. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_ADBReInit )(UInt32 refCon, Boolean inPostProcess);
  1101. /* 1.7 and later*/
  1102. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetCalibration )(UInt32 refCon, void *calibration, Size *calibrationSize);
  1103. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetCalibration )(UInt32 refCon, void *calibration, Size calibrationSize);
  1104. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_CalibrateDialog )(UInt32 refCon, Boolean *changed);
  1105. /* these functions are exported in the driver's pef container (1.7 or later)*/
  1106. EXTERN_API_C( OSStatus )
  1107. ISpDriver_CheckConfiguration    (Boolean *                validConfiguration);
  1108.  
  1109. EXTERN_API_C( OSStatus )
  1110. ISpDriver_FindAndLoadDevices    (Boolean *                keepDriverLoaded);
  1111.  
  1112. EXTERN_API_C( OSStatus )
  1113. ISpDriver_DisposeDevices        (void);
  1114.  
  1115. EXTERN_API_C( void )
  1116. ISpDriver_Tickle                (void);
  1117.  
  1118. typedef CALLBACK_API_C( OSStatus , ISpDriver_CheckConfigurationPtr )(Boolean *validConfiguration);
  1119. typedef CALLBACK_API_C( OSStatus , ISpDriver_FindAndLoadDevicesPtr )(Boolean *keepDriverLoaded);
  1120. typedef CALLBACK_API_C( OSStatus , ISpDriver_DisposeDevicesPtr )(void );
  1121. typedef CALLBACK_API_C( void , ISpDriver_TicklePtr )(void );
  1122. /* ********************* driver level functions ********************* */
  1123.  
  1124. /*
  1125.  *
  1126.  * ISpDevice_New
  1127.  *
  1128.  * This creates a new device from the device definition structure and returns
  1129.  * the result into the device reference.
  1130.  *
  1131.  * Returns Codes
  1132.  * paramErr
  1133.  * out of memory
  1134.  * 
  1135.  * Specical Considerations
  1136.  * may not be done at interrupt time
  1137.  */
  1138. EXTERN_API_C( OSStatus )
  1139. ISpDevice_New                    (const ISpDeviceDefinition * inStruct,
  1140.                                  ISpDriverFunctionPtr_MetaHandler  metaHandler,
  1141.                                  UInt32                 refCon,
  1142.                                  ISpDeviceReference *    outReference);
  1143.  
  1144. /*
  1145.  * ISpDevice_Dispose
  1146.  *
  1147.  * This disposes an existing device.
  1148.  *
  1149.  * Returns Codes
  1150.  * paramErr
  1151.  *
  1152.  * Special Considerations
  1153.  * May not be done at interrupt time
  1154.  *
  1155.  */
  1156. EXTERN_API_C( OSStatus )
  1157. ISpDevice_Dispose                (ISpDeviceReference     inReference);
  1158.  
  1159.  
  1160. /*
  1161.  *
  1162.  * ISpElementDefinitionStruct
  1163.  *
  1164.  * This is the structure that defines everything static about this
  1165.  * element.  For each element on your device you will need to 
  1166.  * fill in one of these structures when your driver loads.
  1167.  *
  1168.  */
  1169. struct ISpElementDefinitionStruct
  1170. {
  1171.     ISpDeviceReference device;  /* device this element belongs to */
  1172.     UInt32 group;                /* group this element belongs to or 0 */
  1173.  
  1174.     Str63 theString;         /* a string that is a human readable identifier for this element, internationalization ? */
  1175.  
  1176.     ISpElementKind kind;
  1177.     ISpElementLabel label;
  1178.  
  1179.     void *configInfo;         /* a pointer to the buffer containing the configuration information for this element */
  1180.     UInt32 configInfoLength; /* length of that configuration info */
  1181.  
  1182.     UInt32 dataSize;         /* the size of the data, so we can generate an appropriate buffer */
  1183.  
  1184.     UInt32 reserved1;
  1185.     UInt32 reserved2;
  1186.     UInt32 reserved3;
  1187. };
  1188. typedef struct ISpElementDefinitionStruct ISpElementDefinitionStruct;
  1189. /*
  1190.  *
  1191.  * ISpElement_New
  1192.  *
  1193.  * ISpElement_New takes an element definition struct and gives you back a element reference.
  1194.  * When you produce data you use that element reference to give the data to the system.
  1195.  * 
  1196.  * Return Codes
  1197.  * paramErr
  1198.  * memory error
  1199.  *
  1200.  * Special Considerations
  1201.  * The ISpElement_New function may move or purge memory.  Your application should not call this function 
  1202.  * at interrupt time.
  1203.  * 
  1204.  */
  1205. EXTERN_API_C( OSStatus )
  1206. ISpElement_New                    (const ISpElementDefinitionStruct * inStruct,
  1207.                                  ISpElementReference *    outElement);
  1208.  
  1209. /*
  1210.  *
  1211.  * ISpElement_Dispose
  1212.  *
  1213.  * ISpElement_Dispose takes an element reference and deletes it.
  1214.  * You should call this function when your driver unloads.
  1215.  *
  1216.  * Return Codes
  1217.  * paramErr
  1218.  * memory error
  1219.  *
  1220.  * Special Considerations
  1221.  * The ISpElement_Dispose function may move or purge memory.  Your application should not call this function 
  1222.  * at interrupt time.
  1223.  * 
  1224.  */
  1225. EXTERN_API_C( OSStatus )
  1226. ISpElement_Dispose                (ISpElementReference     inElement);
  1227.  
  1228. /*
  1229.  *
  1230.  * ISpElement_PushSimpleData
  1231.  *
  1232.  * ISpElement_PushSimpleData is the appropriate way to give the system data if your data fits exactly into
  1233.  * a 32 bit signed number.  You pass the element reference that goes with the data, the data and the 
  1234.  * AbsoluteTime that data was produced.  If UpTime is not available you should fill time.lo with the
  1235.  * TickCount time and time.hi with 0.
  1236.  *
  1237.  * Return Codes
  1238.  * paramErr
  1239.  *
  1240.  */
  1241. EXTERN_API_C( OSStatus )
  1242. ISpElement_PushSimpleData        (ISpElementReference     inElement,
  1243.                                  UInt32                 data,
  1244.                                  const AbsoluteTime *    time);
  1245.  
  1246. /*
  1247.  *
  1248.  * ISpElement_PushComplexData
  1249.  *
  1250.  * ISpElement_PushComplexData is exactly like ISpElement_PushSimpleData except that it is appropriate for times
  1251.  * when your data does not fit into a signed 32 bit integer.
  1252.  *
  1253.  * Instead it takes the length of your data (which must match the datasize field of your ISpElementDefinitionStruct)
  1254.  * and a ptr to the devices state.
  1255.  *
  1256.  * Return Codes
  1257.  * paramErr
  1258.  *
  1259.  */
  1260. EXTERN_API_C( OSStatus )
  1261. ISpElement_PushComplexData        (ISpElementReference     inElement,
  1262.                                  UInt32                 buflen,
  1263.                                  void *                    state,
  1264.                                  const AbsoluteTime *    time);
  1265.  
  1266. /*  ***********************************************************************************  */
  1267.  
  1268. typedef UInt32                             ISpADBDeferRef;
  1269. typedef CALLBACK_API_C( void , ISpADBDeferCallbackProcPtr )(UInt8 adbCommand, void *adbBuffer, UInt32 refcon);
  1270. EXTERN_API_C( OSErr )
  1271. ISpAllocateADBDeferBlock        (ISpADBDeferRef *        createBlock);
  1272.  
  1273. EXTERN_API_C( OSErr )
  1274. ISpDisposeADBDeferBlock            (ISpADBDeferRef         disposeBlock);
  1275.  
  1276. EXTERN_API_C( OSErr )
  1277. ISpInstallADBDefer                (ISpADBDeferRef         refBlock,
  1278.                                  ADBAddress             reqAddress,
  1279.                                  ISpADBDeferCallbackProcPtr  installProc,
  1280.                                  UInt32                 clientRefCon,
  1281.                                  ADBServiceRoutineUPP *    prevRoutine,
  1282.                                  Ptr *                    prevDataArea);
  1283.  
  1284. EXTERN_API_C( OSErr )
  1285. ISpRemoveADBDefer                (ISpADBDeferRef         refBlock);
  1286.  
  1287.  
  1288. #if PRAGMA_STRUCT_ALIGN
  1289.     #pragma options align=reset
  1290. #elif PRAGMA_STRUCT_PACKPUSH
  1291.     #pragma pack(pop)
  1292. #elif PRAGMA_STRUCT_PACK
  1293.     #pragma pack()
  1294. #endif
  1295.  
  1296. #ifdef PRAGMA_IMPORT_OFF
  1297. #pragma import off
  1298. #elif PRAGMA_IMPORT
  1299. #pragma import reset
  1300. #endif
  1301.  
  1302. #ifdef __cplusplus
  1303. }
  1304. #endif
  1305.  
  1306. #endif /* __INPUTSPROCKET__ */
  1307.  
  1308.